#ifndef BABYENGINE_GAME_INTERFACE_H__
#define BABYENGINE_GAME_INTERFACE_H__

#include "Engine.h"
#include "Player.h"
#include "protocol/Protocol.h"

#include <map>

/**
 * Jogo
 */
class Game
{
public:

	bool handleMessage( const String& msg );

	~Game(void);

	static Game& getInstance(void);


	void initServer(const WindowSettings& ws);
	void initClient( const WindowSettings& ws);
	Protocol* getProtocol(void);

protected:

	static Game singleton;

	Game(void);

	Game(const Game&);
	Game& operator=(const Game&);

	void handleJoin( const StringVector& msg  );
	void handleSpawnPoint( const StringVector& msg  );
	void handleStartGame( const StringVector& msg  );
	void handleQuitGame( const StringVector& msg  );
	void handleDisconnect( const StringVector& msg  );
	void handleReconnect( const StringVector& msg  );
	void handleClient( const StringVector& msg  );
	void handleAttack( const StringVector& msg  );
	void handleMove( const StringVector& msg  );
	void handleCollect( const StringVector& msg  );
	void handleDamage( const StringVector& msg  );
	void handleKill( const StringVector& msg  );
	void handleSpawn( const StringVector& msg  );
	void handleItem( const StringVector& msg  );


	typedef std::map< String, Player > PlayerMap;
	PlayerMap _players;
	/// Se o nick for "server", então é servidor
	String _nick;
	unsigned short _serverPort;
	String _serverIp;

	Protocol* _proto;



};

#endif /* BABYENGINE_GAME_INTERFACE_H__ */
